//
//  PushAction.swift
//  MagaCore
//
//  Created by MrMessy on 2023/5/28.
//

import Foundation
import ReSwift
import ReSwiftThunk
import SwiftUI

enum HTEnumPushAction: Action {
  case htEnumPageToPlayScreen(var_push: HTPush?)
  case htEnumChangeColorScheme(var_colorScheme: ColorScheme)

  static func ht_pageToPlayScreen(var_push: [String: Any]?) -> Thunk<HTAppState> {
    Thunk<HTAppState> { dispatch, _ in
      if (var_push == nil ) {
        dispatch(HTEnumPushAction.htEnumPageToPlayScreen(var_push: nil))
      } else {
        let var_push = HTPush.deserialize(from: var_push)!
        dispatch(HTEnumPushAction.htEnumPageToPlayScreen(var_push: var_push))
      }
    }
  }

  static func ht_changeColorScheme(var_colorScheme: ColorScheme) -> Thunk<HTAppState> {
    Thunk<HTAppState> { dispatch, _ in
      dispatch(HTEnumPushAction.htEnumChangeColorScheme(var_colorScheme: var_colorScheme))
    }
  }
}
